package com.test;

import com.djhu.newscollector.crawel.base.AyncCrawel;
import com.djhu.newscollector.crawel.base.Crawler;
import com.djhu.newscollector.crawel.core.Url;
import com.djhu.newscollector.crawel.imp.cl.ClProcessMatcher;
import com.djhu.newscollector.crawel.imp.dispacth.JmsJobDispatcher;
import com.djhu.newscollector.crawel.imp.holder.RedisJobHolder;
import com.djhu.newscollector.crawel.imp.wangyi.WangyiProcessMatcher;
import com.djhu.newscollector.crawel.imp.worker.MongoService;
import com.djhu.newscollector.crawel.imp.worker.WangyiNewsWorker;

/**
 * Created by zw on 2018/2/12.
 */
public class ClCrwael {

    public static void main(String[] args) {
        JmsJobDispatcher dispatcher = new JmsJobDispatcher("failover:(tcp://127.0.0.1:61616)","news");
        RedisJobHolder redisJobHolder = new RedisJobHolder("192.168.1.3",6389,"hiup");
//        Url url = new Url();
//        url.setUrl("wewew");
//        redisJobHolder.contains(url);
        //Worker worker = new Crawler.PrintWorker();


        ClProcessMatcher processMatcher = new ClProcessMatcher();
        processMatcher.setJobDispatcher(dispatcher);
        processMatcher.setJobHolder(redisJobHolder);

        WangyiNewsWorker worker = new WangyiNewsWorker();
        worker.setProcessMatcher(processMatcher);


        AyncCrawel crawler = new AyncCrawel();
        crawler.setJobDispatcher(dispatcher);
        crawler.setJobHolder(redisJobHolder);
        crawler.setWorker(worker);

        crawler.process(null);;
    }
}